/*
 * Copyright 2007 National Bioinformatics Network
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package dgbgui.modeldocument.definition;

import dgbgui.modeldocument.AttributePrototype;
import dgbgui.modeldocument.primitives.ConceptType;

public class FilteredConceptDefinition extends FilteredInstanceDefinition  {

    // ---------- Constructors ----------

    public FilteredConceptDefinition(ConceptType conceptType) {
        super(conceptType);

    }

    // ---------- Methods ----------


    public String getdgbQLString() {
        // If one attribute prototype is specified, then only use that one,
        // otherwise an intersection of all the sets created by the different
        // attributes should
        // be constructed
        String dgbQLString = "";

        if (m_attribPrototypes.size() == 0) {
            dgbQLString = "ct:" + getTypeName() + ".*";
        } else {

            int index = 0;
            for (AttributePrototype attrProto : m_attribPrototypes) {
                if (index > 0) {
                    dgbQLString += " AND ";
                }
                dgbQLString += "ct:" + getTypeName() + "."
                        + attrProto.getName() + "["
                        + attrProto.getdgbQLFilterValue() + "]";
                ++index;
            }
        }
        return dgbQLString;
    }




    // ------------------- Serialization -------------
    
    /**
     * First serilization version
     */
    private static final long serialVersionUID = 1L;
    

    // ---------- Fields ----------




}
